import express from 'express';
import authRouter from './auth.js';
import studentRouter from './students.js';
import teacherRouter from './teachers.js';
import classRouter from './classes.js';
import courseRouter from './courses.js';
import gradeRouter from './grades.js';
import classGradeRouter from './classGrades.js';
import collegeRouter from './colleges.js';
import dormitoryRouter from './dormitories.js';
import attendanceRouter from './attendance.js';
import userRouter from './users.js';
import marketingRouter from './marketing.js';
import dashboardRouter from './dashboard.js';
import permissionRouter from './permissions.js';

const router = express.Router();

// 注册所有路由
router.use('/auth', authRouter);
router.use('/students', studentRouter);
router.use('/teachers', teacherRouter);
router.use('/classes', classRouter);
router.use('/courses', courseRouter);
router.use('/grades', gradeRouter);
router.use('/class-grades', classGradeRouter);
router.use('/colleges', collegeRouter);
router.use('/dormitories', dormitoryRouter);
router.use('/attendance', attendanceRouter);
router.use('/users', userRouter);
router.use('/marketing', marketingRouter);
router.use('/dashboard', dashboardRouter);
router.use('/permissions', permissionRouter);

// 调试：打印所有注册的路由
console.log('已注册权限路由: /api/permissions');

// setupRoutes函数用于在server.js中初始化路由
export function setupRoutes(app) {
    // 这个函数可以用于需要app实例的路由设置
    // 目前保持为空，因为所有路由都通过/api前缀注册
}

export default router;
